import service from '@/utils/request'

import LoginWork from '@/utils/LoginWork'

// 分类
export const classify = () => {
  return service.post<any, any>(`/back/getMtlType?levelCode=${'2'}&typeNo=${''}`)
}

// 指令明细查询
export interface LotNoQueryParms {
  lotNo: string
  style: string
  custom: string
  orderDateStart: string
  orderDateEnd: string
  deliveryDateStart: string
  deliveryDateEnd: string
  pageSize: number
  pageNum: number
}

export const LotNoQuery = (LotNoQueryParms: LotNoQueryParms) => {
  return service.post<any, any>(`/MaterialClearance/getLotNoList`, LotNoQueryParms)
}

// 汇总材料明细查询
export interface SummaryMateriaParms {
  type: string
  mtlName: string
  mtlColor: string
  hideFlag: string
  typeNo: string
  lotNo: string
  pageSize: number
  pageNum: number
}

export const SummaryMaterialDetail = (SummaryMateriaParms: SummaryMateriaParms) => {
  return service.post<any, any>(`/MaterialClearance/getSummaryMaterialsList`, SummaryMateriaParms)
}

// 订购程序查询
export const OrderingProgramQuery = (parms: any) => {
  return service.post<any, any>(`/MaterialClearance/getPurchaseOrderList`, parms)
}

// 形成订购单
export const FormAPurchaseOrder = (parms: any) => {
  return LoginWork.post<any, any>(`/MaterialClearance/makePurchaseOrder`, parms)
}

// 请购批处理
export const BatchProcessingOfPurchaseRequests = (parms: any) => {
  return LoginWork.post<any, any>(`/MaterialClearance/getBatchProcess`, parms)
}

// 查询所有
export const QueryAll = (parms: any) => {
  return service.post<any, any>(`/MaterialClearance/getAllPurchaseOrderList`, parms)
}

// 单行取消订购单
export const SingleCancelPurchaseOrder = (parms: any) => {
  return LoginWork.post<any, any>(`/MaterialClearance/backPurchaseOrder`, parms)
}

// 置空订购信息
export const EmptyOrderingInformation = (parms: any) => {
  return LoginWork.post<any, any>(`/MaterialClearance/cancelPurchaseOrder`, parms)
}

// 订购取消
export const OrderCancellation = (parms: any) => {
  return LoginWork.post<any, any>(`/MaterialClearance/cancelPurchaseOrderNumber`, parms)
}

// 退回
export const bank = (parms: any) => {
  return LoginWork.post<any, any>(`/MaterialClearance/sendBack`, parms)
}

// 指令查询
export const lotNoQuery = () => {
  return service.get<any, any>(`/MaterialClearance/getAllLotNoList?lotNo=${''}`)
}

// 批量退回
export const BatchReturn = (parms: any) => {
  return LoginWork.post<any, any>(`/MaterialClearance/sendBackBatch`, parms)
}

// 批量修改
export const batchModifying = (parms: any) => {
  return LoginWork.post<any, any>(`/MaterialClearance/updatePurchaseOrderBatch`, parms)
}

// 厂商查询
export const ManufacturerQuery = () => {
  return service.get<any, any>(`/mes/api/commonQuery/queryAllVendor`)
}
